package com.price.sample.http.service

import com.price.httplib.base.BaseHttpApiService
import com.price.sample.http.myinterface.FakerApi
import okhttp3.Interceptor

/**
 * FakerApiService
 *
 */
object FakerApiService : BaseHttpApiService() {
    override fun getServiceUrl(): String? {
        return "https://httpbin.org/"
    }
    override fun getInterceptor(): List<Interceptor> {
        val headerInterceptor=Interceptor { chain ->
            val builder = chain.request().newBuilder()
            builder.addHeader("Source", "source")
            chain.proceed(builder.build())
        }
        return listOf(headerInterceptor)
    }


    /**
     * 再次封装一次，减少调用的代码量
     *
     */
    fun getService(): FakerApi {
        return getService(FakerApi::class.java)
    }

}

